package com.example.core.controller;

import com.example.core.service.BaseEnumService;
import com.example.core.utils.Result;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;


/****
 *
 * 获取枚举类型
 */
@RestController
public class BaseEnumController {

    @Resource
    private BaseEnumService baseEnumService;

    @RequestMapping(value = "getEnum")
    public Result getEnumList(String className) {
        try {
            List<Map<String, String>> mapList = baseEnumService.getEnumByClassName(className);
            return Result.success(mapList);
        } catch (Exception e) {
            return Result.error(e.getMessage());
        }
    }
}
